<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
	String path=request.getScheme()+"://"+request.getServerName()+":"+
	request.getServerPort()+request.getContextPath()+"/";
	pageContext.setAttribute("path", path);
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=this.getServletContext().getContextPath() %>/register/">
    <title>查看</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../static/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../static/css/style.css" />
    <script type="text/javascript" src="../static/js/jquery-3.4.1.js"></script>

    <script type="text/javascript" src="../static/js/bootstrap.js"></script>
    <script type="text/javascript" src="../static/js/ckform.js"></script>
    <script type="text/javascript" src="../static/js/common.js"></script>
    <script type="text/javascript" src="../static/js/ckeditor/ckeditor.js"></script>
 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>


</head>
<body>
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">病历号</td>
        <td id = "rid"> </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">姓名</td>
        <td id = "name"> </td>
    </tr>

    <tr>
        <td width="10%" class="tableleft">身份证号</td>
        <td id = "idCard"> </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">挂号费</td>
        <td ><strong id = "registerMoney" style="color: red;"></strong>元</td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">社保号</td>
        <td id = "siNumber"> </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">联系电话</td>
        <td id = "phone"> </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">是否自费</td>
        <td id = "isPay">
        	 
        </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">性别</td>
        <td id = "sex">
	         
       	</td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">年龄</td>
        <td id = "age"> </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">初复诊</td>
        <td id = "consultation">
        	 
        </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">所挂科室</td>
        <td id = "department">
        	 
        </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">指定医生</td>
        <td id = "dname">
        	 
        </td>
    </tr>
	<tr>
        <td width="10%" class="tableleft">备注</td>
        <td id = "remark"> </td>
	</tr>
    <tr>
        <td colspan="2">
			<center>
				<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
			</center>
		</td>
    </tr>
</table>

<script type="text/javascript">
	$(function(){
		var url = location.search;
		var rid = url.split("rid=")[1];
		$.ajax({
			url:"${path}registers/getRegisterInfo",
 			type:"post",
 			data:{"rid":rid},
 			dataType:"json",
 			success:function(message){
				console.log("-----------------"); 				
				console.log(message); 				
				console.log("********************"); 
				
				$("#rid").html(message.rid);
				$("#name").html(message.name);
				$("#idCard").html(message.idCard);
				$("#registerMoney").html(message.registerMoney);
				$("#siNumber").html(message.siNumber);
				$("#phone").html(message.phone);
				if(message.isPay.toString() == "1"){
					$("#isPay").html("否");
				}else{
					$("#isPay").html("是");
				}
				
				
				if(message.sex.toString() == "0"){
					$("#sex").html("男");
				}else{
					$("#sex").html("女");
				}
				
				$("#age").html(message.age);
				
				if(message.consultation.toString() == "0"){
					$("#consultation").html("初诊");
				}else{
					$("#consultation").html("复诊");
				}

				$("#department").html(department(message.department));
				$("#dname").html(message.dname);
				$("#remark").html(message.remark);

				
				
 			}

		});

	})
	
	 	// 科室;
 	function department(department){
 		
 		if(department.toString() == "1"){
 			return "急诊科";
 		}else if(department.toString() == "2"){
 			return "儿科";
 		}else if(department.toString() == "3"){
 			return "妇科";
 		}else if(department.toString() == "4"){
 			return "皮肤科";
 		} else if(department.toString() == "5"){
 			return "内分泌科";
 		}else if(department.toString() == "6"){
 			return "牙科";
 		}else{
 			return "xxx";
 		}

 	}
	
	
	
	
	$('#backid').click(function(){
			window.history.back(-1);
	});

</script>


</body>
</html>